/* CQFS Engine
 * Copyright (c) 2006-2007 Blazing Games Inc. All Rights Reserved
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; 
 * version 2.1 of the License.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package com.blazinggames.cqfsTesting
{
/**
* A simple sample demonstrating the use of the TestingInterface and 
* TestingResults class. This could also be considered to be a test of the
* testing implementation.
* 
* @author Billy D. Spelchan
* @version 1.0
*/
public class SampleTest
implements TestingInterface
{
	function SampleTest()
	{
		
	}

// *************************************************
// ***** functions for running the sample test *****
// *************************************************

	/**
	* Runs the tests and returns the test results.
	* 
	* @return test results in TestingResults class.
	*/
	public function runStandaloneTests():TestingResults
	{
		var results:TestingResults = new TestingResults();
		
		try {
			results.addSuccessTestResult("First successful test succeeds", successfulTest());
			results.addSuccessTestResult("Second successful test succeeds", successfulTest());
			results.addSuccessTestResult("Third successful test failed", failedTest());
			results.addSuccessTestResult("Fourth successful test succeeds", successfulTest());
			results.addNotImplemented("Fifth successful test not implemented");
			results.addFailureTestResult("First failure test failed as it should", ! failedTest());
			results.addFailureTestResult("Second failure test did not fail", ! successfulTest());
			results.addFailureTestResult("Third failure test failed as it should", ! failedTest());
			results.addNotImplemented("fourth failure test not implemented");
			results.addNotImplemented("Fifth failure test not implemented");
			
			// comment out next line if you want a successful run
			throw new Error("Forced error for demonstrating error reporting");
		} catch (err:Error) {
			results.reportCriticalFailure("Error occurred: " + err.message);
		}
		
		return results;
	}
	
	function successfulTest():Boolean
	{
		return true;
	}
	
	function failedTest():Boolean
	{
		return false;
	}
	
}// end class
}// end package
